package cn.seaboot.admin.excel.service;

import cn.seaboot.admin.excel.bean.ExcelLog;
import cn.seaboot.admin.excel.dao.ExcelLogDao;
import cn.seaboot.commons.core.Snowflake;
import cn.seaboot.commons.core.SnowflakeFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * Service
 * Excel解析日志 [t_sys_excel_log]
 *
 * @author Mr.css on 2018-6-20
 */
@Service
public class ExcelLogService {
    private final Snowflake snowflake = SnowflakeFactory.createSnowflake();

    @Resource
    private ExcelLogDao sysExcelLogDao;

    /**
     * 增
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int insert(ExcelLog pojo) {
        pojo.setId(snowflake.nextId());
        return sysExcelLogDao.insert(pojo);
    }

    /**
     * 删
     *
     * @param id id
     * @return affected rows
     */
    public int deleteById(String id) {
        return sysExcelLogDao.deleteById(id);
    }

    /**
     * 改
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int updateById(ExcelLog pojo) {
        return sysExcelLogDao.updateSampleById(pojo);
    }

    /**
     * 查
     *
     * @param id id
     * @return pojo
     */
    public ExcelLog queryById(String id) {
        return sysExcelLogDao.selectById(id);
    }

    /**
     * 查列表
     *
     * @param params 参数
     * @return list
     */
    public List<ExcelLog> queryList(Map<String, Object> params) {
        return sysExcelLogDao.selectList(params);
    }
}
